<%@page import="java.nio.file.attribute.UserDefinedFileAttributeView"%>
<html>
	<head>
		<meta name="layout" content="main"/>
		<link rel="stylesheet" href="${resource(dir: 'css', file: 'bootstrap.css')}" type="text/css"/> 
		<link rel="stylesheet" href="${resource(dir: 'css', file: 'image.css')}" type="text/css"/>
		<title>uTalk - Message</title>
	</head>
	<body>
	<ul class="nav nav-pills">
		<li><a href="${createLink(controller:'user', action:'home')}">Home</a></li>
  		<li><a href="${createLink(controller:'user', action:'profile')}">Profile</a></li>
  		<li class="active"><a href="${createLink(controller:'user', action:'message')}">Messages</a></li>		
	</ul>
	
	<h3>${flash.type}  <span class="label label-default">New</span></h3>
	<div>${flash.fail_error_user }</div>
	<g:form action="sendMessage" controller="user" role="form">
	
		<div class="input-group input-group-lg">
		  	<span class="input-group-addon">Message</span>
		 	<input type="text" class="form-control" placeholder="Username" name="userReceiver">
		</div>
		<br><br>
		<input type="text" class="form-control" placeholder="Message" name="message">
		
		<div class="btn-group">
		  <button class="btn btn-default" type="submit">Send</button>
		</div>
		
	</g:form>

	<table class="table table-striped">
		<g:each var="mp" in="${flash.message}">
			<g:if test="${mp?.userSender?.path == null}">
				<div class="media">
			    	<img class="media-object mini" src="${resource(dir: 'images', file: 'inconu.gif')}">
				</div>
			</g:if>
			<g:else>
				<div class="media">
					<g:if test="${mp?.userSender?.url == true}">
	    				<img class="media-objec thumb" src="${mp?.userSender?.path}">
	    			</g:if>
	    			<g:else>
	    				 <img class="media-objec thumb" src="${resource(dir: 'images', file: "${mp?.userSender?.path}")}">
	    			</g:else>		
				</div>
			</g:else>
			<span class="label label-info">${mp?.userSender?.pseudo}</span>
			<br/>
			<div>${mp?.texte}</div>
			<br/>
			<br/>
		</g:each>
	</table>

		
	</body>
</html>